package com.example.java_chatroom_redis_rabbitmq.model;

import lombok.Data;

@Data
public class Result<T> {
    private Integer status;
    private T data;
    private String message;

    public static<T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.setStatus(200);
        result.setData(data);
        return result;
    }

    public static<T> Result<T> fail(Integer status, T data, String message) {
        Result<T> result = new Result<>();
        result.setStatus(status);
        result.setData(data);
        result.setMessage(message);
        return result;
    }
}
